from DrissionPage import SessionPage

# 创建页面对象
page = SessionPage()

for i in range(1, 11):
    page.get(f'https://ssr1.scrape.center/page/{i}')
    # 获取所有电影卡片
    cards = page.eles('.el-card__body')

    for card in cards:
        # 电影名称
        name = card.ele('.name h2').text

        # 类别
        categories = [btn.text for btn in card.eles('.category')]

        # 国家和时长
        info = card.eles('.info span')
        country = info[0].text
        duration = info[2].text

        # 上映日期
        release_date = card.ele('.info span', index=-1).text

        # 评分
        score = card.ele('.score').text

        # 输出结果
        print(f"电影名称: {name}")
        print(f"类别: {', '.join(categories)}")
        print(f"国家: {country}")
        print(f"时长: {duration}")
        print(f"上映日期: {release_date}")
        print(f"评分: {score}")
        print("-" * 50)